<template>
	<!--订单页面-->
	<view class="wrapper" :style="{height:wrapperHeight +'px'}">
		<!--<view class="title-padding"></view>-->
		<!-- <view class="headerGd">
			<view class="header">
				<button class="back" @tap="back()"></button>
				{{OrderTitle}}
				<button class="filter" @tap="filter()"></button>
			</view>
		</view> -->
		<view class="container" :style="{height: containerHeight + 'px'}">
			<view class="curstom">
				<view class="filterTime">
					<text>商品名:{{NowGoodName}}</text>
					<text>{{isSale?"客户":"供应商"}}:{{NowClient}}</text>
				</view>
				<view class="filterTime">
					<text>{{startTime}}</text>
					<text>{{endTime}}</text>
				</view>
			</view>
			<view class="orderList" :style="{height: orderListHeight + 'px'}" v-show="isList">
				<view class="orderNav" :style="{width:tdAllWidth+'px'}" @tap="changeWidth()">
					<text :style="{width:tdWidth[0]+'px'}">
						序号
					</text>
					<text :style="{width:tdWidth[1]+'px'}">
						商品名称
					</text>
					<text :style="{width:tdWidth[2]+'px'}">
						编号
					</text>
					<text :style="{width:tdWidth[3]+'px'}">
						规格
					</text>
					<text :style="{width:tdWidth[4]+'px'}">
						单位
					</text>
					<text :style="{width:tdWidth[5]+'px'}" @tap.stop.prevent="paixu1(0)">
						{{isSale?"销售数量":"进货数量"}}
						<label class="text-blue text-xl" :class="paixu0?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
					<text :style="{width:tdWidth[6]+'px'}" @tap.stop.prevent="paixu1(1)">
						{{isSale?"销售金额":"进货金额"}}
						<label class="text-blue text-xl" :class="paixu01 ?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
					<text :style="{width:tdWidth[7]+'px'}" @tap.stop.prevent="paixu1(2)">
						退货数量
						<label class="text-blue text-xl" :class="paixu02?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
					<text :style="{width:tdWidth[8]+'px'}" @tap.stop.prevent="paixu1(3)">
						退货金额
						<label class="text-blue text-xl" :class="paixu03?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
					<text :style="{width:tdWidth[9]+'px'}" @tap.stop.prevent="paixu1(4)">
						{{isSale?"销售数(未审)":"进货数(未审)"}}
						<label class="text-blue text-xl" :class="paixu04?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
					<text :style="{width:tdWidth[10]+'px'}" @tap.stop.prevent="paixu1(5)">
						退货数(未审)
						<label class="text-blue text-xl" :class="paixu05?'cuIcon-triangledownfill':'cuIcon-triangleupfill'"></label>
					</text>
				</view>
				<view class="orderLi" :style="{height:orderLiHeight +'px',width:tdAllWidth+'px'}">
					<view class="orderItem" v-for="(item,index) in orderList" :key="index">
						<text :style="{width:tdWidth[0]+'px'}">
							{{index+1}}
						</text>
						<text :style="{width:tdWidth[1]+'px'}">
							{{item.GoodsName}}
						</text>
						<text :style="{width:tdWidth[2]+'px'}">
							{{item.GoodsCode}}
						</text>
						<text :style="{width:tdWidth[3]+'px'}">
							{{item.Spec}}
						</text>
						<text :style="{width:tdWidth[4]+'px'}">
							{{item.UnitName}}
						</text>
						<text :style="{width:tdWidth[5]+'px'}">
							{{isSale?item.Qty:item.In_Qty}}
						</text>
						<text :style="{width:tdWidth[6]+'px'}">
							{{isSale?item.Amount:item.In_Amount}}
						</text>
						<text :style="{width:tdWidth[7]+'px'}">
							{{isSale? Math.round(item.T_Qty * 100) / 100:item.In_out_Qty}}
						</text>
						<text :style="{width:tdWidth[8]+'px'}">
							{{isSale?item.T_Amount:item.In_out_Amount}}
						</text>
						<text :style="{width:tdWidth[9]+'px'}">
							{{isSale?item.Qty2:item.In_Qty2}}
						</text>
						<text :style="{width:tdWidth[10]+'px'}">
							{{isSale?item.T_Qty2:item.In_out_Qty2}}
						</text>
					</view>
				</view>
				<view class="allPrice" :style="{width:tdAllWidth+'px'}">
					<text :style="{width:tdWidth[0]+'px'}">
						小计
					</text>
					<text :style="{width:tdWidth[1]+'px'}">

					</text>
					<text :style="{width:tdWidth[2]+'px'}">

					</text>
					<text :style="{width:tdWidth[3]+'px'}">

					</text>
					<text :style="{width:tdWidth[4]+'px'}">

					</text>
					<text :style="{width:tdWidth[5]+'px'}">
						{{inPurSaleAmount}}
					</text>
					<text :style="{width:tdWidth[6]+'px'}">
						{{inPurSaleQty}}
					</text>
					<text :style="{width:tdWidth[7]+'px'}">
						{{outPurQty}}
					</text>
					<text :style="{width:tdWidth[8]+'px'}">
						{{outPurAmount}}
					</text>
					<text :style="{width:tdWidth[9]+'px'}">
						{{inGetQty}}
					</text>
					<text :style="{width:tdWidth[10]+'px'}">
						{{ouGetQty}}
					</text>
				</view>
			</view>
			<view class="orderLookAllList" :style="{height: orderListHeight + 'px'}" v-show="!isList">
				<view class="orderLookItem" v-for="(item,index) in orderList" :style="{ display:(nowRote === index) ? 'table':'block'}"
				 :key="index" @tap="lookMore(index)">
					<text>{{index+1}}</text>
					<text>编号:{{item.GoodsCode}}</text>
					<text>商品名称:{{item.GoodsName}}</text>
					<text>单位:{{item.UnitName}}</text>
					<text>规格:{{item.Spec}}</text>
					<text>{{isSale?"销售数量":"进货数量"}}:{{isSale?item.Qty:item.In_Qty}}</text>
					<text>{{isSale?"销售金额":"进货金额"}}:{{isSale?item.Amount:item.In_Amount}}</text>
					<text>退货数量:{{isSale? Math.round(item.T_Qty * 100) / 100:item.In_out_Qty}}</text>
					<text>退货金额:{{isSale?item.T_Amount:item.In_out_Amount}}</text>
					<text>{{isSale?"销售数(未审)":"进货数(未审)"}}:{{isSale?item.Qty2:item.In_Qty2}}</text>
					<text>退货数(未审):{{isSale?item.T_Qty2:item.In_out_Qty2}}</text>
					<!-- <button class="lookMoreInfo" :style="{ transform :()  ? 'rotate(180deg)':'rotate( 0deg)'}"> -->
					<button class="lookMoreInfo">
						{{nowRote == index?'收起':'展开'}}
					</button>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="showChange?'show':'hide'">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">设置表格列宽度</view>
					<view class="action" @tap="hideChaneg">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<view class="padding-xl">
					<view class="padding-xl-item">
						<text>序号:</text><input v-model="tdWidthList[0]" />
					</view>
					<view class="padding-xl-item">
						<text>编号:</text><input v-model="tdWidthList[1]" />
					</view>
					<view class="padding-xl-item">
						<text>商品名称:</text><input v-model="tdWidthList[2]" />
					</view>
					<view class="padding-xl-item">
						<text>单位:</text><input v-model="tdWidthList[3]" />
					</view>
					<view class="padding-xl-item">
						<text>规格:</text><input v-model="tdWidthList[4]" />
					</view>
					<view class="padding-xl-item">
						<text>{{isSale?"销售数量":"进货数量"}}:</text><input v-model="tdWidthList[5]" />
					</view>
					<view class="padding-xl-item">
						<text>{{isSale?"销售金额":"进货金额"}}:</text><input v-model="tdWidthList[6]" />
					</view>
					<view class="padding-xl-item">
						<text>退货数量:</text><input v-model="tdWidthList[7]" />
					</view>
					<view class="padding-xl-item">
						<text>退货金额:</text><input v-model="tdWidthList[8]" />
					</view>
					<view class="padding-xl-item">
						<text>{{isSale?"销售数(未审)":"进货数(未审)"}}:</text><input v-model="tdWidthList[9]" />
					</view>
					<view class="padding-xl-item">
						<text>退货数(未审):</text><input v-model="tdWidthList[10]" />
					</view>
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn bg-grey float-left" @tap="hideChaneg">取消</button>
						<button class="cu-btn stop margin-left" @tap="sureSetting">确定</button>
					</view>
				</view>
			</view>
		</view>
	</view>


</template>
<script>
	import * as Api from '@/syApis/syBb/apis.js'
	export default {
		onLoad(options) {
			//采购订单
			if (options.type == 0) {
				this.isSale = false;
				uni.setNavigationBarTitle({
					title: "采购查询(商品汇总)"
				});
				this.NowClient = "全部供应商"
			}
			//销售订单
			else {
				this.isSale = true;
				uni.setNavigationBarTitle({
					title: "销售查询(商品汇总)"
				})
				this.NowClient = "全部客户"
			}
			// 获取表格框的宽度
			let tbWidList = uni.getStorageSync("OrderWidList", "");
			// console.log(OrderList);
			if (tbWidList != "") {
				this.tdWidthList = JSON.parse(tbWidList);
				this.tdWidth = JSON.parse(tbWidList);
			}
			var $this = this;
			uni.getSystemInfo({
				success(res) {
					$this.wrapperHeight = res.windowHeight;
					$this.containerHeight = res.windowHeight - 50;
					$this.orderListHeight = res.windowHeight - 50;
					$this.orderLiHeight = res.windowHeight - 50 - 80;
				}
			});
			let date = new Date();
			
			this.getTime();
			this.getCgOrder();
		},
		watch: {
			//统计数量
			orderList(oldval, newval) {
				console.log(newval);
				var inPurSaleQty = 0;
				var inPurSaleAmount = 0
				var outPurQty = 0;
				var outPurAmount = 0;
				var inGetQty = 0;
				var ouGetQty = 0;
				var _this = this;
				this.orderList.forEach(item => {
					console.log(_this.isSale);
					inPurSaleQty += (_this.isSale ? item.Amount : item.In_Amount);
					inPurSaleAmount += (_this.isSale ? item.Qty : item.In_Qty);
					outPurQty += (_this.isSale ? parseFloat(item.T_Qty) : item.In_out_Qty);
					outPurAmount += (_this.isSale ? item.T_Amount : item.In_out_Amount);
					inGetQty += (_this.isSale ? item.Qty2 : item.In_Qty2);
					ouGetQty += (_this.isSale ? item.T_Qty2 : item.In_out_Qty2);
				});

				this.inPurSaleQty = inPurSaleQty;
				this.inPurSaleAmount = inPurSaleAmount;
				this.outPurQty = outPurQty;
				this.outPurAmount = outPurAmount;
				this.inGetQty = inGetQty;
				this.ouGetQty = ouGetQty;
			}
		},
		computed: {
			tdAllWidth() {
				var tdAllWidth = 0;
				this.tdWidth.forEach(item => {
					tdAllWidth += parseFloat(item);
				});
				tdAllWidth += this.tdWidth.length - 1;
				return tdAllWidth;
			},
// 			tdThList() {
// 				var list = [];
// 				let item = {};
// 				if (this.isSale) {
// 					this.tdHeaderList1.forEach((item, index) => {
// 						item = {
// 							name: item.name
// 						};
// 						list.push(item);
// 					})
// 
// 				} else {
// 					this.tdHeaderList2.forEach((item, index) => {
// 						item = {
// 							name: item.name
// 						};
// 						list.push(item);
// 					})
// 
// 				}
// 				console.log(list);
// 				return list;
// 			}
		},
		methods: {
			getTime() {
				let yyyy = new Date().getFullYear();
				let mm = (new Date().getMonth() + 1)< 10 ? '0' + (new Date().getMonth() + 1) : (new Date().getMonth() + 1);
				let dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate();
				this.startTime = yyyy + '-' + mm + '-' + dd;
				this.endTime = yyyy + '-' + mm + '-' + dd;
			},
			paixu1(selectIndex) {
				console.log(selectIndex)
				var len = this.orderList.length;
				var arr = this.orderList
				if (this.isSale) {
					switch (selectIndex) {
						case 0:
							if (this.paixu0 == false) {
								this.paixu0 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Qty > arr[j + 1].Qty) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu0 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Qty < arr[j + 1].Qty) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 1:
							if (this.paixu01 == false) {
								this.paixu01 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Amount > arr[j + 1].Amount) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu01 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Amount < arr[j + 1].Amount) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 2:
							if (this.paixu02 == false) {
								this.paixu02 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Qty > arr[j + 1].T_Qty) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu02 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Qty < arr[j + 1].T_Qty) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 3:
							if (this.paixu03 == false) {
								this.paixu03 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Amount > arr[j + 1].T_Amount) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu03 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Amount < arr[j + 1].T_Amount) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 4:
							if (this.paixu04 == false) {
								this.paixu04 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Qty2 > arr[j + 1].Qty2) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu04 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].Qty2 < arr[j + 1].Qty2) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 5:
							if (this.paixu05 == false) {
								this.paixu05 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Qty2 > arr[j + 1].T_Qty2) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu05 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].T_Qty2 < arr[j + 1].T_Qty2) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;
					}

				} else {
					switch (selectIndex) {
						case 0:
							if (this.paixu0 == false) {
								this.paixu0 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Qty > arr[j + 1].In_Qty) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu0 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Qty < arr[j + 1].In_Qty) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 1:
							if (this.paixu01 == false) {
								this.paixu01 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Amount > arr[j + 1].In_Amount) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu01 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Amount < arr[j + 1].In_Amount) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 2:
							if (this.paixu02 == false) {
								this.paixu02 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Qty > arr[j + 1].In_out_Qty) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu02 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Qty < arr[j + 1].In_out_Qty) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 3:
							if (this.paixu03 == false) {
								this.paixu03 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Amount > arr[j + 1].In_out_Amount) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu03 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Amount < arr[j + 1].In_out_Amount) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 4:
							if (this.paixu04 == false) {
								this.paixu04 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Qty2 > arr[j + 1].In_Qty2) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu04 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_Qty2 < arr[j + 1].In_Qty2) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;

						case 5:
							if (this.paixu05 == false) {
								this.paixu05 = true
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Qty2 > arr[j + 1].In_out_Qty2) { //相邻元素两两对比
											var temp = arr[j + 1];
											//元素交换
											arr[j + 1] = arr[j];
											arr[j] = temp;
										}
									}
								}
							} else {
								this.paixu05 = false
								for (var i = 0; i < len; i++) {
									for (var j = 0; j < len - 1 - i; j++) {
										if (arr[j].In_out_Qty2 < arr[j + 1].In_out_Qty2) { //相邻元素两两对比
											var temp = arr[j];
											//元素交换
											arr[j] = arr[j + 1];
											arr[j + 1] = temp;
										}
									}
								}
							}
							return arr;
							break;
					}

				}
			},
			
			//修改宽度
			changeWidth() {
				this.showChange = true;
			},
			hideChaneg() {
				this.showChange = false;
				let tempList = [];
				this.tdWidth.forEach((item,index)=>{
					tempList.push(item);
				})
				this.tdWidthList = tempList;
				// uni.setStorageSync("tbWidList",JSON.stringify(tempList));
				// this.tdWidthList = this.tdWidth;
			},
			sureSetting() {
				let tempList = [];
				this.tdWidthList.forEach((item,index)=>{
					tempList.push(item);
				})
				this.tdWidth = tempList;
				uni.setStorageSync("OrderWidList",JSON.stringify(tempList));
				this.showChange = false;
			},
			AddListen() {
				var _this = this;
				this.$eventHub.$on('fire', function(data) {
					_this.startTime = data.StartDate;
					_this.EndDate = data.EndDate;
					_this.GoodsName = data.GoodsName;
					_this.StoreID = data.StoreID;
					_this.NowClient = typeof data.ClientName == "undefined" ? (_this.isSale?"全部客户":"全部供应商") : data.ClientName;
					_this.NowGoodName =typeof data.GoodsName == "undefined" ? "全部商品" : data.GoodsName;
					_this.getCgOrder(data);
					_this.$eventHub.$off('fire');
				});
			},
			//返回上一页
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			// #ifndef MP
			onNavigationBarButtonTap(e) {
				const index = e.index;
				if (index === 0) {
					let type = this.isSale ? "1" : "0"
					this.AddListen();
					uni.navigateTo({
						url: './orderFilter?type=' + type
					})
				}else{
					this.changeListAl();
				}
			},
			// #endif
			//获取采购订单
			getCgOrder: function(filter) {
				let data = {};
				if (filter == undefined) {
					data = {
						StartDate: this.startTime,
						EndDate: this.endTime
					}
				} else {;
					data = filter;
				}
				var _this = this;
				if (_this.isSale) {
					console.log(_this.isSale);
					Api.GetSaleOrder(data, function(res) {
						if (res.state) {
							if (res.data.ErrorMsg == "获取登录信息失败") {

							} else if (res.data.ErrorMsg != "") {
								Api.showTip(res.data.ErrorMsg);
							} else {
								if(res.data.ResultMsg.length==0){
									Api.showTip("查无数据");
								}
								_this.orderList = _this.setTwoFloat(res.data.ResultMsg);
							}
						} else {
							Api.showTip("服务器开小差了");
						}
					});
				} else {
					Api.GetCgOrder(data, function(res) {
						console.log(_this.isSale);
						if (res.state) {
							if (res.data.ErrorMsg == "获取登录信息失败") {

							} else if (res.data.ErrorMsg != "") {
								Api.showTip(res.data.ErrorMsg);
							} else {
								if(res.data.ResultMsg.length==0){
									Api.showTip("查无数据");
								}
								_this.orderList = _this.setTwoFloat(res.data.ResultMsg);
							}
						} else {
							Api.showTip("服务器开小差了");
						}
					});
				}
			},
			setTwoFloat(arr) {
				if (this.isSale) {
					arr.forEach((item, index) => {
						arr[index].Amount = Api.setTwoFloat(item.Amount);
						arr[index].Qty = Api.setTwoFloat(item.Qty);
						arr[index].T_Amount = Api.setTwoFloat(item.T_Amount);
						arr[index].Amount = Api.setTwoFloat(item.Amount);
						arr[index].Qty2 = Api.setTwoFloat(item.Qty2);
						arr[index].T_Qty2 = Api.setTwoFloat(item.T_Qty2);
					});
				} else {
					arr.forEach((item, index) => {
						arr[index].In_Amount = Api.setTwoFloat(item.In_Amount);
						arr[index].In_Qty = Api.setTwoFloat(item.In_Qty);
						arr[index].In_out_Qty = Api.setTwoFloat(item.In_out_Qty);
						arr[index].In_out_Amount = Api.setTwoFloat(item.In_out_Amount);
						arr[index].In_Qty2 = Api.setTwoFloat(item.In_Qty2);
						arr[index].In_out_Qty2 = Api.setTwoFloat(item.In_out_Qty2);
					});
				}
				return arr;
			},
			lookMore: function(index) {
				this.nowRote = this.nowRote == index ? "-1" : index;
			},
			changeListAl: function() {
				this.isList = !this.isList;
			}
		},
		data() {
			return {
				paixu0: false,
				paixu01: false,
				paixu02: false,
				paixu03: false,
				paixu04: false,
				paixu05: false,
				isClient: true,
				showChange: false,
				orderList: [],
				containerHeight: 100,
				wrapperHeight: 600,
				orderListHeight: 100,
				orderLiHeight: 100,
				isList: false,
				startTime: "",
				endTime: "",
				curstomName: "全部客户",
				//订单页标题
				OrderTitle: "",
				//是否销售订单
				isSale: false,
				nowRote: -1,
				//进货/销售数量总计
				inPurSaleQty: 0,
				//进货/销售金额总计
				inPurSaleAmount: 0,
				//退货数量总计
				outPurQty: 0,
				//退货金额总计
				outPurAmount: 0,
				//进货数总计
				inGetQty: 0,
				//退货数总计
				ouGetQty: 0,
				xjList: [{
						name: "小计"
					}, {
						name: "备注"
					}, {
						name: "备注"
					}, {
						name: ""
					}, {
						name: ""
					}, {
						name: ""
					}, {
						name: ""
					}, {
						name: ""
					},
					{
						name: ""
					},
					{
						name: ""
					},
					{
						name: ""
					}
				],
				list: [{
						name: 0,
						"openAndClose": "",
						"lookMoreClass": ""
					},
					{
						name: 0,
						"openAndClose": "",
						"lookMoreClass": ""
					}, {
						name: 0,
						"openAndClose": "",
						"lookMoreClass": ""
					}
				],
				//td宽度列表
				tdWidth: [50, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125],
				tdWidthList: [50, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125],
				NowGoodName:"全部商品",
				NowClient:""
				//tb表头
				// tdHeaderList2: [{
				// 		name: "序号"
				// 	},
				// 	{
				// 		name: "商品名称"
				// 	}, {
				// 		name: "编号"
				// 	}, {
				// 		name: "规格"
				// 	}, {
				// 		name: "单位"
				// 	}, {
				// 		name: "进货数量"
				// 	}, {
				// 		name: "进货金额"
				// 	}, {
				// 		name: "退货数量"
				// 	}, {
				// 		name: "退货金额"
				// 	}, {
				// 		name: "进货数(未审)"
				// 	}, {
				// 		name: "退货数(未审)"
				// 	}
				// ]
			}
		}
	}
</script>

<style lang="scss">
	@import url('../../style/changecolum.scss');
	@import '@/static/bbCss/bb.scss';
	/*图标的大小*/
	// $iconWidth:20px;
	// $iconHeight:20px;
	// $iconBackSize:20px;
	// $bb-bg-color:rgba(124, 170, 216, 1);

	// .title-padding {
	// 	height: var(--status-bar-height);
	// 	background: $bb-bg-color;
	// 	box-sizing: content-box;
	// }

	// page {
	// 	width: 100%;
	// 	height: 100%;
	// 	padding-bottom: 0px;
	// }

	// .wrapper {
	// 	width: 100%;
	// 	height: 100%;
	// 	display: flex;
	// 	flex-direction: column;
	// 	overflow: hidden;
	// }

	// button::after {
	// 	border: none;
	// 	padding: 0px;
	// }

	// .sureBt1 {
	// 	width: 100%;
	// 	height: 50px;
	// 	text-align: center;
	// 	position: absolute;
	// 	bottom: 0px;
	// 	z-index: 999;

	// 	.qd-btn {
	// 		position: fixed;
	// 		width: 90%;
	// 		background: #FFFFFF;

	// 		button {
	// 			width: 100px;
	// 			height: 40px;
	// 			margin-top: 5px;
	// 			line-height: 40px;
	// 			font-size: 12px;
	// 			float: right;
	// 			background: #007AFF;
	// 			color: #FFF;
	// 			margin-right: 10px;
	// 		}
	// 	}

	// }

	// .headerGd {
	// 	width: 100%;
	// 	height: 100upx;
	// 	line-height: 100upx;
	// 	background: $bb-bg-color;
	// 	display: table;

	// 	.header {
	// 		position: relative;
	// 		text-align: center;
	// 		font-size: 16px;
	// 		color: #FFF;

	// 		.back {
	// 			width: $iconWidth;
	// 			height: $iconHeight;
	// 			background: url(../../static/back.png) no-repeat;
	// 			position: absolute;
	// 			left: 10px;
	// 			top: 15px;
	// 			background-size: $iconBackSize;
	// 		}

	// 		.filter {
	// 			width: $iconWidth;
	// 			height: $iconHeight;
	// 			position: absolute;
	// 			right: 10px;
	// 			top: 15px;
	// 			background: url(../../static/cg/filter.png);
	// 		}
	// 	}
	// }

	// .container {
	// 	font-size: 14px;

	// 	.curstom {
	// 		width: 100%;
	// 		height: 50px;
	// 		line-height: 50px;
	// 		display: flex;
	// 		padding-left: 10px;
	// 		padding-right: 10px;
	// 		box-sizing: border-box;
	// 		background: rgba(124, 170, 216, 1);
	// 		box-sizing: border-box;
	// 		color: #FFF;

	// 		.curstomName {
	// 			flex: 1;
	// 			text-align: center;
	// 		}

	// 		.filterTime {
	// 			flex: 4;
	// 			text-align: center;
	// 			// display: flex;
	// 			// flex-direction: column;
	// 			white-space: nowrap;
	// 			text-overflow: ellipsis;
	// 			overflow: hidden;
	// 			text {
	// 				// flex: 1;
	// 				line-height: 25px;
	// 				height: 25px;
	// 				display:block ;
	// 				white-space: nowrap;
	// 				text-overflow: ellipsis;
	// 				overflow: hidden;
	// 				box-sizing: border-box;
	// 				padding-left: 2px;
	// 				padding-bottom: 2px;
	// 				text-align: left;
	// 			}
	// 		}
	// 		.filterTime:last-child{
	// 			flex: 2;
	// 		}

	// 		.changeList {
	// 			width: 30px;
	// 			height: 30px;
	// 			background: url(../../static/changeIcon.png) no-repeat;
	// 			background-size: 100%;
	// 			margin-top: 15px;
	// 		}
	// 	}

	// 	//表格单据
	// 	.orderList {
	// 		width: 100%;
	// 		overflow: auto;
	// 		box-sizing: border-box;

	// 		text {
	// 			float: left;
	// 			text-align: center;
	// 			box-sizing: border-box;
	// 			height: 40px;
	// 			line-height: 40px;
	// 			border-right: 1px solid #CCC;
	// 			white-space: nowrap;
	// 			text-overflow: ellipsis;
	// 			overflow: hidden;

	// 			&:last-child {
	// 				border: none;
	// 			}
	// 		}

	// 		.orderNav {
	// 			height: 40px;
	// 			line-height: 40px;

	// 			box-sizing: border-box;
	// 			overflow: hidden;
	// 			border-top: 1px solid #CCC;
	// 			border-left: 1px solid #FFF;
	// 			background: #FFF;
	// 		}

	// 		.orderLi {

	// 			background: #ebebeb;
	// 			overflow: auto;

	// 			.orderItem {
	// 				height: 40px;
	// 				line-height: 40px;
	// 				width: 100%;
	// 				border: 1px solid #ebebeb;
	// 				box-sizing: border-box;
	// 				display: table;
	// 				border-bottom: 1px solid #CCCCCC;

	// 				view {
	// 					display: inline-block;
	// 					height: 100%;
	// 					line-height: 40px;
	// 					float: left;
	// 					text-align: center;
	// 					border-right: 1px solid #CCC;
	// 					box-sizing: border-box;
	// 					padding-top: 5upx;
	// 					padding-bottom: 5upx;
	// 					white-space: nowrap;
	// 					text-overflow: ellipsis;
	// 					overflow: hidden;

	// 					image {
	// 						width: 60px;
	// 						margin: auto;
	// 						display: table;
	// 					}

	// 					&:last-child {
	// 						border: none;
	// 					}

	// 				}
	// 			}
	// 		}

	// 		.allPrice {
	// 			@extend .orderNav;
	// 			background: rgba(124, 170, 216, 1);
	// 			color: #FFF;
	// 		}
	// 	}

	// 	//列表单据
	// 	.orderLookAllList {
	// 		width: 100%;
	// 		background: #ebebeb;
	// 		box-sizing: border-box;
	// 		padding: 30upx;
	// 		box-sizing: border-box;
	// 		overflow: auto;

	// 		.orderLookItem {
	// 			width: 100%;
	// 			height: 220upx;
	// 			overflow: hidden;
	// 			position: relative;
	// 			border-radius: 20upx;
	// 			background: #FFF;
	// 			box-sizing: border-box;
	// 			padding-left: 30upx;
	// 			padding-right: 100upx;
	// 			padding-top: 5upx;
	// 			padding-bottom: 5upx;
	// 			margin-bottom: 20upx;
	// 		}

	// 		.lookMoreInfo {
	// 			width: $iconWidth;
	// 			height: $iconHeight;
	// 			background: url(../../static/pull.png) no-repeat;
	// 			position: absolute;
	// 			bottom: 10upx;
	// 			right: 10upx;
	// 			padding: 0upx;
	// 			background-size: 100% 100%;
	// 			transition: height 2s;
	// 		}

	// 		text {
	// 			display: block;
	// 			font-size: 30upx;

	// 			&:nth-child(1) {
	// 				position: absolute;
	// 				top: 10upx;
	// 				right: 10upx;
	// 				width: $iconWidth;
	// 				height: $iconHeight;
	// 				border-radius: 10upx;
	// 				text-align: center;
	// 				display: table;
	// 				color: #000;
	// 				line-height: $iconHeight;
	// 				padding: 5upx;
	// 			}

	// 			&:nth-child(n+2) {
	// 				height: 55upx;
	// 				line-height: 55upx;
	// 				display: table;
	// 			}
	// 		}

	// 		.lookMoreClass {
	// 			display: table;

	// 		}

	// 		.openAndClose {
	// 			transform: rotate(180deg);
	// 		}
	// 	}

	// }

	// //查看大图
	// .lookBig {
	// 	position: fixed;
	// 	width: 100%;
	// 	height: 100%;
	// 	overflow: auto;
	// 	top: 0;
	// 	left: 0;
	// 	background: rgba(0, 0, 0, .3);

	// 	image {
	// 		width: 70%;
	// 		margin: auto;
	// 		margin-top: 10%;
	// 	}
	// }

	// .padding-xl {
	// 	overflow: auto;
	// 	max-height: 400px;
	// }

	// .padding-xl-item {
	// 	display: flex;
	// }

	// .padding-xl-item text {
	// 	min-width: 70px;
	// 	height: 40px;
	// 	line-height: 40px;
	// 	text-align: right;
	// 	padding-right: 10px;
	// 	box-sizing: border-box;
	// 	font-size: 15px;
	// }

	// .padding-xl-item input {
	// 	flex: 1;
	// 	border: 1px solid #CCC;
	// 	height: 30px;
	// 	line-height: 30px;
	// 	margin-top: 5px;
	// }

	// .stop {
	// 	padding-left: 12px;
	// 	padding-right: 12px;
	// 	font-size: 14px;
	// 	background: rgba(124, 170, 216, 1);
	// 	color: #FFF;
	// 	box-sizing: border-box;
	// 	margin-left: 40px;
	// }
</style>
